package net.anzix.jhacks.flexclipse.builder.hyperlinks;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.IHyperlink;

public class MXMLTagHyperlink implements IHyperlink{

	public MXMLTagHyperlink(final IWorkspaceRunnable action, final IFile file,
			final IRegion region) {
		super();
		this.action = action;
		this.file = file;
		this.region = region;
	}

	private IFile file;
	private IWorkspaceRunnable action;
	private IRegion region;

	public IRegion getHyperlinkRegion() {
		return region;
	}

	public String getHyperlinkText() {
		return null;
	}

	public String getTypeLabel() {
		return null;
	}

	public void open() {
		try {
			file.getWorkspace().run(action, null,IWorkspace.AVOID_UPDATE, null);
		} catch (CoreException e) {
			e.printStackTrace();
		}
	}

}
